<?php
include("../conn.php");
$seleprosql="select * from pro";
$seleproquery=mysqli_query($con,$seleprosql);
if(isset($_POST['subpro']))
{
	$upsql="update pro set proname='".$_POST['proname']."',projieshao='".$_POST['projieshao']."' where id='".$_GET['proid']."'";
	mysqli_query($con,$upsql);
	echo "修改成功!<script></script>";
	exit;
}
if(isset($_GET['proid']) && $_GET['del']=="yes")
{
	$delsql="delete from pro where id='".$_GET['proid']."'";
	mysqli_query($con,$delsql);
	echo "删除成功!<a href=editpro.php>返回</a>";
	exit;
}
if(isset($_GET['proid']) && $_GET['proid'])
{
	$sql="select * from pro where id='".$_GET['proid']."'";
	$row=mysqli_fetch_array(mysqli_query($con,$sql),MYSQLI_ASSOC);
?>
	<form enctype="multipart/form-data" method="post" action="">
		产品名称：<input type=text name=proname value=<?php echo $row['proname']?> /><br />
		产品介绍:<br /><textarea cols=40 rows=15 name=projieshao ><?php echo $row['projieshao']?> </textarea><br />
	  <input type=submit value=修改产品 name=subpro />
	</form>
<?php
exit;
}
while($seleprorow=mysqli_fetch_array($seleproquery,MYSQLI_ASSOC))
{
	echo "<a href=?proid=".$seleprorow['id'].">".$seleprorow['proname']."</a> <a href=?proid=".$seleprorow['id']."&del=yes>删除</a><br>";
}
?>